class Particle_group {

  int number_of_particles; 

  Particle[] particles;

  ArrayList dead_list;


  System system;

  Particle_group(int number_of_particles) {
    particles  = new Particle[number_of_particles];
    dead_list = new ArrayList();

    this.number_of_particles = number_of_particles;

    for(int x=0;x<number_of_particles;x++) {
      particles[x] = new Particle();
    }
  }

  void render() {
    for(int x=0;x<number_of_particles;x++) {
      particles[x].render();
    }
  }

  void math() {
    for(int x=0;x<number_of_particles;x++) {
      particles[x].math();
    }
  }

  boolean kill_particle(Particle particle) {
    if(particle.get_alive()) {
      particle.set_alive(false);
      dead_list.add(particle);
      return true;
    }
    else {
     // println(" ::dead things cant die:: ERROR:PARTICLE_GROUP.KILL_PARTICLE ");
      return false;
    }
  }

  Particle live_particle(float x_loc, float y_loc) {
    Particle particle;

    particle = (Particle)dead_list.get(0);
    dead_list.remove(0);

    particle.reset(x_loc,y_loc);
    particle.set_alive(true);
    return particle;
  }

  int dead_list_size() {
    return dead_list.size();
  }
}

